package com.mty.controller;

import com.mty.entity.Product;
import com.mty.service.ProductService;
import com.mty.service.impl.ProductImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author ：Teacher马（2508531326@qq.com）
 * @date ：Created in 2022/11/17 18:00
 * @description：
 * @modified By：
 * @version:
 */
@RestController
@RequestMapping("product")
public class ProductController {
    @Autowired
  private ProductService productService;
    @GetMapping("/getById/{pid}")
    public Product getById(@PathVariable Long pid){
        return productService.findId(pid);
    }

    @Value("${student.name}")
    private  String name;

    @GetMapping("getInfo")
    public  String getInfo(){
        return  "名字"+name;
    }
}
